import React, { Component } from 'react'
import theme from "../css/com.module.css"
import theme1 from "../css/theme1.module.css"
import theme2 from "../css/theme2.module.css"
export default class Com extends Component {
    constructor(props){
        super(props);
        this.state={
            theme:theme1,
            myStyle:{color:"red"}
        }
    }
    qh(){
        this.setState({
            theme:this.state.theme==theme1?theme2:theme1
        })
    }
    myStyle(){
        this.setState({
            myStyle:{...this.state.myStyle,color:"blue"}
        })
    }
  render() {
    return (
        <>
        <div className={theme.error}>局部样式</div>
        <div className={this.state.theme.bg}>换色背景</div>
        <div> <button onClick={()=>{
            this.qh();
        }}>点击换色</button></div>
        <div style={this.state.myStyle} onClick={()=>{
            this.myStyle();
        }}>行内样式</div>
       
        </>
      
    )
  }
}
